package com.buba.system.controller;

import com.buba.system.pojo.Role;
import com.buba.system.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 角色管理控制层
 */
@Controller
@RequestMapping("/Role")
public class RoleController {
    private RoleService roleService;

    @RequestMapping("/selRole.do")
    @ResponseBody
    public Map<String,Object> selRole(){
        Map<String,Object> map = new HashMap<>();
        List<Role> list = roleService.selRole();
        //list.forEach(System.out::println);
        map.put("data",list);
        map.put("msg","");
        map.put("count",list.size());
        map.put("code",0);
        return map;
    }



    public RoleService getRoleService() {
        return roleService;
    }
    @Autowired
    public void setRoleService(RoleService roleService) {
        this.roleService = roleService;
    }
}
